$(() => {
    $('#login').click(() => {
        const username = $('#username')[0].value
        const password = $('#password')[0].value
        $.ajax({
            url: "http://47.94.207.7:3000/api/m/login/login",
            method: "POST",
            data: {
                username,
                password
            },
            success: (res) => {
                if (res.code == 200) {
                    $.message({
                        message: res.msg,
                        type: 'success'
                    });
                    localStorage.setItem('token', res.data)
                    location.href = '/my-order.html'
                } else {
                    $.message({
                        message: res.msg,
                        type: 'error'
                    });
                }
                console.log(res);
            }
        })
    })
})